<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>跑马灯定时器</title>
    <style>
        div {
            color: pink;
            font-size: 20px;
            letter-spacing: 0.3em;
        }
    </style>
</head>

<body>
    <div>欢迎光临全家便利店</div>
</body>
<script>
    setInterval(function () {
        let title = document.title;
        let str1 = title[0]; //title.charAt(0)
        let str2 = title.slice(1); //title.substr(1);
        document.title = str2 + str1;

    }, 500)
    setInterval(function () {
        let str = document.querySelector('div').textContent;
        let str1 = str[0]; //str.charAt(0)
        let str2 = str.slice(1); //str.substr(1);
        document.querySelector('div').textContent = str2 + str1;

    }, 500)

    // console.log(location.host);
    // console.log(location.hostname);
</script>

</html>